"use strict";

const { Controller } = require("egg");

class MovieController extends Controller {
  async searchByPreset() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.searchByPreset(data);
    ctx.success(ret);
  }
  async updateInfo() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.updateInfo(dat);
    ctx.success(ret);
  }

  async getClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.getClassify(data);
    ctx.success(ret);
  }
  async addClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.addClassify(data);
    ctx.success(ret);
  }
  async deleteClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.deleteClassify(data);
    ctx.success(ret);
  }
  async updateClassify() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.updateClassify(dat);
    ctx.success(ret);
  }
  async addMovie() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.addMovie(data);
    ctx.success(ret);
  }
  async deleteMovie() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.deleteMovie(data);
    ctx.success(ret);
  }

  async getMovieList() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    data.query = data?.query ?? {};
    let ret = await service.movie.getMovieList(data);
    ctx.success(ret);
  }

  async getMovieDetail() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.movie.getMovieDetail(data);
    ctx.success(ret);
  }
}

module.exports = MovieController;
